using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GameSite.Models.Mapping
{
    public class GameNewMap : EntityTypeConfiguration<GameNew>
    {
        public GameNewMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.IsSlide)
                .IsRequired();

            this.Property(t => t.IsTop)
                .IsRequired();

            this.Property(t => t.IsHot)
                .IsRequired();

            this.Property(t => t.CategoryID)
                .IsRequired();

            this.Property(t => t.Title)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Content)
                .IsRequired();

            this.Property(t => t.CreateBy)
                .IsRequired()
                .HasMaxLength(32);

            this.Property(t => t.CreateTime)
                .IsRequired();

            this.Property(t => t.subTitle)
                .HasMaxLength(50);

            this.Property(t => t.ShortTitle)
                .HasMaxLength(16);

            this.Property(t => t.ImageTitle)
                .HasMaxLength(2000);

            // Table & Column Mappings
            this.ToTable("GameNews");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.IsSlide).HasColumnName("IsSlide");
            this.Property(t => t.IsTop).HasColumnName("IsTop");
            this.Property(t => t.IsHot).HasColumnName("IsHot");
            this.Property(t => t.CategoryID).HasColumnName("CategoryID");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.Content).HasColumnName("Content");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.subTitle).HasColumnName("subTitle");
            this.Property(t => t.ShortTitle).HasColumnName("ShortTitle");
            this.Property(t => t.ImageTitle).HasColumnName("ImageTitle");
        }
    }
}
